const { contextBridge, ipcRenderer } = require('electron')



contextBridge.exposeInMainWorld('myAPI', {
    version: process.version,
    saveFile: (data) => {
        ipcRenderer.send('file-save', data)
    },
    readFile() {
        return ipcRenderer.invoke('file-read')
    },
    invokeWithData: async (channel, data) => {
        return await ipcRenderer.invoke(channel, data)
    },
    invoke: async channel => {
        return await ipcRenderer.invoke(channel)
    }
})
